﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ServiceModel;
using DEsbInterface;
using System.Threading;

namespace DEsbClientConsole
{
    class Program
    {
        static void Main(string[] args)
        {
            Thread.Sleep(1000);

            NetTcpBinding binding = new NetTcpBinding();
            binding.OpenTimeout = new TimeSpan(0, 10, 0);
            binding.SendTimeout = new TimeSpan(0, 10, 0);
            binding.ReceiveTimeout = new TimeSpan(0, 10, 0);
            binding.Security.Mode = SecurityMode.None;
            binding.Security.Transport.ClientCredentialType = TcpClientCredentialType.None;
            EndpointAddress address = new EndpointAddress("net.tcp://192.168.4.191:9998/adminsrv");

            IAdmin usr = ChannelFactory<IAdmin>.CreateChannel(binding, address);

            usr.CheckPermission(1);
            Console.ReadKey();
            usr.WillOutofMemory();
            //try
            //{
            //    Console.WriteLine(usr.CheckPermission(1).ToString());
            //}
            //catch(Exception ex)
            //{
            //    Console.WriteLine(ex.Message);
            //    Console.WriteLine(ex.InnerException.Source);
            //}
            Console.ReadKey();

        }

    }
}
